<h1>; Form for table <?= $this->table ?></h1>
<pre>
[fields]
<?
foreach($this->detail as $item): 
$field = $item['Field'];
?>
<? print_r($item, 1) ?>

<? if (strcasecmp($item['Key'], 'PRI')):
?>
; field "<?= $field ?>"

elements.<?= $field ?>.type = "text"
elements.<?= $field ?>.options.label = "<?= ucwords(str_replace('_', ' ', $field)) ?>"
<? if (preg_match('~varchar\((.*)\)~', $item['Type'], $match)): ?>
elements.<?= $field ?>.options.validators.strlen.validator = "StringLength"
elements.<?= $field ?>.options.validators.strlen.options.min = "0"
elements.<?= $field ?>.options.validators.strlen.options.max = "<?= $match[1] ?>"

<? endif; ?>
<? else: ?>

; primary field <?= $field ?>

elements.<?= $field ?>.type = "hidden"
<? endif; ?>

<? endforeach; ?>

</pre>